package com.eboss2.sbs.enums;


import com.eboss2.sbs.R;
import com.tool.utils.utils.StringUtils;

import java.util.Map;

public class EnumConsts {


    public enum Device {
        Normal("正常", 1),
        Stop("停用", 2),
        Close("注销", 3),;
        private String name;
        private int type;

        private Device(String name, int type) {
            this.name = name;
            this.type = type;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public int getType() {
            return type;
        }

        public void setType(int type) {
            this.type = type;
        }

        public static Device getByType(int type) {
            Device[] sqbPayStates = Device.values();
            for (Device sqbPayState : sqbPayStates) {
                if (sqbPayState.getType() == type) {
                    return sqbPayState;
                }
            }
            return null;
        }
    }

        //富友扫码渠道
    public enum FYScanChannel {
        PAY_FY_WX("WECHAT"),
        PAY_FY_ALY("ALIPAY");
        private String channel;

        FYScanChannel(String channel) {
            this.setChannel(channel);
        }

        public String getChannel() {
            return channel;
        }

        public void setChannel(String channel) {
            this.channel = channel;
        }
    }




    public enum SqbPayChannel {
        ////支付方式   1支付宝  3 微信  4百付宝 5 京东
        UNKNOWN(0, "未知", "未知", R.mipmap.ic_pay_status_washed, R.mipmap.ic_pay_status_washed, R.color.text_normal),
        ALIPAY(1, "支付宝", "支付宝收款", R.mipmap.ic_pay_alipay, R.mipmap.ic_alipay, R.color.bg_pay_alipay),
        WEIXIN(3, "微信", "微信收款", R.mipmap.ic_pay_weixin, R.mipmap.ic_weixin, R.color.bg_pay_weixin),
        WALLET(13, "钱包", "钱包收款", R.mipmap.icon_qb, R.mipmap.icon_qb, R.color.text_normal),
        BAIDU(4, "百付宝", "百付宝收款", R.mipmap.ic_pay_baidu, R.mipmap.ic_baidu, R.color.bg_pay_baidu),
        JINGDONG(5, "京东", "京东钱包收款", R.mipmap.ic_pay_jingdong, R.mipmap.ic_jingdong, R.color.bg_pay_jingdong),
        CARD(6, "刷卡", "刷卡收款", R.mipmap.ic_pay_jingdong, R.mipmap.ic_jingdong, R.color.bg_pay_jingdong),
        CASH_MEMO(7, "现金", "现金收款", R.mipmap.ic_pay_jingdong, R.mipmap.ic_jingdong, R.color.bg_pay_jingdong),
        CARD_MEMO(8, "刷卡记账", "刷卡记账收款", R.mipmap.ic_pay_jingdong, R.mipmap.ic_jingdong, R.color.bg_pay_jingdong),
        ALIPAYUNDO(12, "支付宝退款", "支付宝退款", R.mipmap.ic_pay_alipay, R.mipmap.ic_alipay, R.color.bg_pay_alipay),
        WEIXINUNDO(11, "微信退款", "微信退款", R.mipmap.ic_pay_weixin, R.mipmap.ic_weixin, R.color.bg_pay_weixin),
        WALLETUNDO(14, "钱包退款", "钱包退款", R.mipmap.icon_qb, R.mipmap.icon_qb, R.color.text_normal),
        STKPAY(19, "会员卡", "会员卡", R.mipmap.stk_card, R.mipmap.stk_card, R.color.text_normal),
        CARD_MEMO_UNDO(10, "刷卡撤销", "刷卡撤销", R.mipmap.ic_pay_jingdong, R.mipmap.ic_jingdong, R.color.bg_pay_jingdong),
        ALL(0, "全部", "全部", R.mipmap.ic_pay_status_washed, R.mipmap.ic_pay_status_washed, R.color.text_normal),;
        private int type;
        private String name;
        private String showName;
        private int icon_id;
        private int icon2_id;
        private int bg_color_id;

        SqbPayChannel(int state, String name, String showName, int icon_id, int icon2_id, int bg_color_id) {
            this.type = state;
            this.name = name;
            this.showName = showName;
            this.icon_id = icon_id;
            this.icon2_id = icon2_id;
            this.bg_color_id = bg_color_id;
        }

        public int getType() {
            return type;
        }

        public String getName() {
            return name;
        }

        public int getIcon_id() {
            return icon_id;
        }

        public String getShowName() {
            return showName;
        }

        public int getIcon2_id() {
            return icon2_id;
        }

        public int getBg_color_id() {
            return bg_color_id;
        }

        public static SqbPayChannel getByType(int type) {
            SqbPayChannel[] sqbPayChannels = SqbPayChannel.values();
            for (SqbPayChannel sqbPayChannel : sqbPayChannels) {
                if (sqbPayChannel.getType() == type) {
                    return sqbPayChannel;
                }
            }
            return UNKNOWN;
        }

        public static int getTypeByName(String name) {
            SqbPayChannel[] sqbPayChannels = SqbPayChannel.values();
            for (SqbPayChannel sqbPayChannel : sqbPayChannels) {
                if (sqbPayChannel.getName().equals(name)) {
                    return sqbPayChannel.getType();
                }
            }
            return -1;
        }

    }

    public enum CashType {
        ////支付方式   1支付宝  3 微信  4百付宝 5 京东
        AMOUNT_0(0, "0"),
        AMOUNT_5(1, "5"),
        AMOUNT_10(2, "10"),
        AMOUNT_20(3, "20"),
        AMOUNT_50(4, "50"),
        AMOUNT_100(5, "100"),
        ;
        private int type;
        private String name;

        CashType(int state, String name) {
            this.type = state;
            this.name = name;
        }

        public int getType() {
            return type;
        }

        public String getName() {
            return name;
        }

        public static CashType getByType(int type) {
            CashType[] sqbPayChannels = CashType.values();
            for (CashType sqbPayChannel : sqbPayChannels) {
                if (sqbPayChannel.getType() == type) {
                    return sqbPayChannel;
                }
            }
            return AMOUNT_0;
        }

        public static int getTypeByName(String name) {
            CashType[] sqbPayChannels = CashType.values();
            for (CashType sqbPayChannel : sqbPayChannels) {
                if (sqbPayChannel.getName().equals(name)) {
                    return sqbPayChannel.getType();
                }
            }
            return -1;
        }

    }

    public enum UpgradeState {
        ////支付方式   1支付宝  3 微信  4百付宝 5 京东
        UNKNOWN(-1, "未知"),
        UPGRADE_FORCE(1, "强制更新"),
        UPGRADE_UNFORCE(2, "非强制更新"),
        LATEST(3, "已经是最新版本");
        private int type;
        private String name;

        UpgradeState(int state, String name) {
            this.type = state;
            this.name = name;
        }

        public int getType() {
            return type;
        }

        public String getName() {
            return name;
        }

        public static UpgradeState getByType(int type) {
            UpgradeState[] sqbPayStates = UpgradeState.values();
            for (UpgradeState sqbPayState : sqbPayStates) {
                if (sqbPayState.getType() == type) {
                    return sqbPayState;
                }
            }
            return null;
        }
    }

    public enum SqbPayState {
        ////支付方式   1支付宝  3 微信  4百付宝 5 京东
        SUCCESS(1, "交易成功"),
        FAIL(2, "交易失败"),
        REFUND(3, "有退款"),;
        private int type;
        private String name;

        SqbPayState(int state, String name) {
            this.type = state;
            this.name = name;
        }

        public int getType() {
            return type;
        }

        public String getName() {
            return name;
        }

        public static SqbPayState getByType(int type) {
            SqbPayState[] sqbPayStates = SqbPayState.values();
            for (SqbPayState sqbPayState : sqbPayStates) {
                if (sqbPayState.getType() == type) {
                    return sqbPayState;
                }
            }
            return null;
        }
    }


    //设备禁用启用
    public enum DeviceStatus {

        STATUS_1(1, "启用中"),
        STATUS_2(2, "禁用中"),
        STATUS_3(3, "故障"),
        STATUS_4(4, "已注销"),
        ;
        private int type;
        private String name;

        DeviceStatus(int state, String name) {
            this.type = state;
            this.name = name;
        }

        public int getType() {
            return type;
        }

        public String getName() {
            return name;
        }

        public static DeviceStatus getByType(int type) {
            DeviceStatus[] sqbPayStates = DeviceStatus.values();
            for (DeviceStatus sqbPayState : sqbPayStates) {
                if (sqbPayState.getType() == type) {
                    return sqbPayState;
                }
            }
            return null;
        }
    }


    public enum PayType {
        ////支付方式   1支付宝  3 微信  4百付宝 5 京东
        SCAN(1, "扫码支付"),
        BARCORD(2, "二维码支付"),;
        private int type;
        private String name;

        PayType(int state, String name) {
            this.type = state;
            this.name = name;
        }

        public int getType() {
            return type;
        }

        public String getName() {
            return name;
        }

        public static PayType getByType(int type) {
            PayType[] sqbPayTypes = PayType.values();
            for (PayType sqbPayType : sqbPayTypes) {
                if (sqbPayType.getType() == type) {
                    return sqbPayType;
                }
            }
            return null;
        }
    }

    /**
     * 钱包提现状态
     */
    public enum WalletDrawStatus {
        WAITING(1, "受理中"),
        SUCCESS(2, "结算成功"),
        FAILURE(3, "结算失败");
        private int status;
        private String name;

        WalletDrawStatus(int status, String name) {
            this.status = status;
            this.name = name;
        }

        public static String getNameByStatus(int status_in) {
            WalletDrawStatus[] walletDrawStatuss = WalletDrawStatus.values();
            for (int i = 0; i < walletDrawStatuss.length; i++) {
                WalletDrawStatus data = walletDrawStatuss[i];
                if (data.getStatus() == status_in) {
                    return data.getName();
                }
            }
            return "";
        }

        public int getStatus() {
            return status;
        }

        public String getName() {
            return name;
        }
    }

    //扫码支付类型   1收钱吧  2 富友
    public enum ScanPayType {
        SQB(1, "收钱吧"),
        FUYOU(2, "富友"),
        WALLET(3, "钱包"),;
        private int type;
        private String name;

        ScanPayType(int state, String name) {
            this.type = state;
            this.name = name;
        }

        public int getType() {
            return type;
        }

        public String getName() {
            return name;
        }

        public static ScanPayType getByType(int type) {
            ScanPayType[] sqbPayTypes = ScanPayType.values();
            for (ScanPayType sqbPayType : sqbPayTypes) {
                if (sqbPayType.getType() == type) {
                    return sqbPayType;
                }
            }
            return null;
        }
    }

    public enum PointState {
        ////支付方式   1支付宝  3 微信  4百付宝 5 京东
        ALL(0, "全部", R.color.point_state_end),
        ONGOING(1, "活动中", R.color.point_state_ongoing),
        TOSTART(2, "待开始", R.color.point_state_tostart),
        END(3, "已结束", R.color.point_state_end),;
        private int state;
        private String name;
        private int color;

        PointState(int state, String name, int color) {
            this.state = state;
            this.name = name;
            this.color = color;
        }

        public int getState() {
            return state;
        }

        public String getName() {
            return name;
        }

        public int getColor() {
            return color;
        }

        public static PointState getByState(int state) {
            PointState[] pointStates = PointState.values();
            for (PointState pointState : pointStates) {
                if (pointState.getState() == state) {
                    return pointState;
                }
            }
            return null;
        }
    }


    public enum OrderStatus {
        ORDER_STATUS_DFK(1, "待付款", R.color.order_status_dfk),
        ORDER_STATUS_DFH(2, "待发货", R.color.order_status_dfh),
        ORDER_STATUS_DPJ(3, "待评价", R.color.order_status_dpj),
        ORDER_STATUS_TKZ(4, "退款中", R.color.order_status_tkz),
        ORDER_STATUS_YWC(5, "已完成", R.color.order_status_ywc),
        ORDER_STATUS_YFH(6, "已发货", R.color.order_status_yfh),
        ORDER_STATUS_YGB(8, "已关闭", R.color.order_status_ygb),
        ORDER_STATUS_YTK(9, "已退款", R.color.order_status_ywc),
        ORDER_STATUS_YQX(7, "已取消", R.color.order_status_ygb),
        ORDER_STATUS_TKJJ(10, "退款拒绝", R.color.order_status_tkz),
        ;
        private int state;
        private String name;
        private int color;

        OrderStatus(int state, String name, int color) {
            this.state = state;
            this.name = name;
            this.color = color;
        }

        public int getState() {
            return state;
        }

        public String getName() {
            return name;
        }

        public int getColor() {
            return color;
        }

        public static OrderStatus getByState(int state) {
            OrderStatus[] pointStates = OrderStatus.values();
            for (OrderStatus pointState : pointStates) {
                if (pointState.getState() == state) {
                    return pointState;
                }
            }
            return null;
        }
    }


    public enum ExmineStatus {
        EXMINE_STATUS_DSH(2, "待审核", R.color.order_status_dfk),
        EXMINE_STATUS_SHJJ(0, "审核拒绝", R.color.order_status_tkz),
        EXMINE_STATUS_SHTG(1, "审核通过", R.color.order_status_ywc),
        ;
        private int state;
        private String name;
        private int color;

        ExmineStatus(int state, String name, int color) {
            this.state = state;
            this.name = name;
            this.color = color;
        }

        public int getState() {
            return state;
        }

        public String getName() {
            return name;
        }

        public int getColor() {
            return color;
        }

        public static ExmineStatus getByState(int state) {
            ExmineStatus[] pointStates = ExmineStatus.values();
            for (ExmineStatus pointState : pointStates) {
                if (pointState.getState() == state) {
                    return pointState;
                }
            }
            return null;
        }
    }

    public enum ServiceExmineStatus {
        EXMINE_STATUS_DSH(1, "待审核", R.color.order_status_dfk),
        EXMINE_STATUS_SHJJ(3, "审核拒绝", R.color.order_status_tkz),
        EXMINE_STATUS_SHTG(2, "审核通过", R.color.order_status_ywc),
        ;
        private int state;
        private String name;
        private int color;

        ServiceExmineStatus(int state, String name, int color) {
            this.state = state;
            this.name = name;
            this.color = color;
        }

        public int getState() {
            return state;
        }

        public String getName() {
            return name;
        }

        public int getColor() {
            return color;
        }

        public static ServiceExmineStatus getByState(int state) {
            ServiceExmineStatus[] pointStates = ServiceExmineStatus.values();
            for (ServiceExmineStatus pointState : pointStates) {
                if (pointState.getState() == state) {
                    return pointState;
                }
            }
            return null;
        }
    }

    public enum CouponState {
        ////支付方式   1支付宝  3 微信  4百付宝 5 京东
        ALL(0, "全部"),
        ONGOING(1, "领取中"),
        OVER(2, "已领完"),
        END(3, "已结束"),;
        private int state;
        private String name;

        CouponState(int state, String name) {
            this.state = state;
            this.name = name;
        }

        public int getState() {
            return state;
        }

        public String getName() {
            return name;
        }

        public static CouponState getByState(int state) {
            CouponState[] couponStates = CouponState.values();
            for (CouponState couponState : couponStates) {
                if (couponState.getState() == state) {
                    return couponState;
                }
            }
            return null;
        }
    }

    public enum TimeZoneType {
        ////支付方式   1支付宝  3 微信  4百付宝 5 京东
        SEVENDAY(0, "近七日"),
        MONTH(1, "本月"),
        MONTHLAST(2, "上月"),
        CUSTOM(3, "自定义"),;
        private int code;
        private String name;

        TimeZoneType(int code, String name) {
            this.code = code;
            this.name = name;
        }

        public int getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

        public static TimeZoneType getByCode(int code) {
            TimeZoneType[] timeZoneTypes = TimeZoneType.values();
            for (TimeZoneType timeZoneType : timeZoneTypes) {
                if (timeZoneType.getCode() == code) {
                    return timeZoneType;
                }
            }
            return null;
        }

        public static int getCodeByName(String name) {
            TimeZoneType[] timeZoneTypes = TimeZoneType.values();
            for (TimeZoneType timeZoneType : timeZoneTypes) {
                if (timeZoneType.getName() == name) {
                    return timeZoneType.getCode();
                }
            }
            return -1;
        }

    }


    //交易类型
    public enum TransactionType {
        ////支付方式   1支付宝  3 微信  4百付宝 5 京东
        ALL(0, "全部"),
        Consumption(1, "消费"),
        Withdraw(4, "提现"),
        Refund(50, "退款"),
        balanceChange(11, "商户余额变动"),
        Profit(15, "分润"),
        ;

        private int code;
        private String name;

        TransactionType(int code, String name) {
            this.code = code;
            this.name = name;
        }

        public int getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

        public static TransactionType getByCode(int code) {
            TransactionType[] timeZoneTypes = TransactionType.values();
            for (TransactionType timeZoneType : timeZoneTypes) {
                if (timeZoneType.getCode() == code) {
                    return timeZoneType;
                }
            }
            return null;
        }

        public static int getCodeByName(String name) {
            TransactionType[] timeZoneTypes = TransactionType.values();
            for (TransactionType timeZoneType : timeZoneTypes) {
                if (timeZoneType.getName() == name) {
                    return timeZoneType.getCode();
                }
            }
            return -1;
        }

    }

    //发展来源
    public enum FromType {
        ////支付方式   1支付宝  3 微信  4百付宝 5 京东
        FROM_1(1, "扫码注册"),
        FROM_2(2, "POS机注册"),;
        private int code;
        private String name;

        FromType(int code, String name) {
            this.code = code;
            this.name = name;
        }

        public int getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

        public static FromType getByCode(int code) {
            FromType[] timeZoneTypes = FromType.values();
            for (FromType timeZoneType : timeZoneTypes) {
                if (timeZoneType.getCode() == code) {
                    return timeZoneType;
                }
            }
            return null;
        }

        public static int getCodeByName(String name) {
            FromType[] timeZoneTypes = FromType.values();
            for (FromType timeZoneType : timeZoneTypes) {
                if (timeZoneType.getName() == name) {
                    return timeZoneType.getCode();
                }
            }
            return -1;
        }

    }

    public enum CustomGradeType {
        ////支付方式   1支付宝  3 微信  4百付宝 5 京东
        CustomType_0(0, "全部"),
        CustomType_1(1, "钻石等级"),
        CustomType_2(2, "黄金等级"),
        CustomType_3(3, "白银等级"),
        CustomType_4(4, "青铜等级"),
        CustomType_5(5, "注册会员"),
        CustomType_6(6, "关注会员"),
        ;
        private int code;
        private String name;

        CustomGradeType(int code, String name) {
            this.code = code;
            this.name = name;
        }

        public int getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

        public static CustomGradeType getByCode(int code) {
            CustomGradeType[] timeZoneTypes = CustomGradeType.values();
            for (CustomGradeType timeZoneType : timeZoneTypes) {
                if (timeZoneType.getCode() == code) {
                    return timeZoneType;
                }
            }
            return null;
        }

        public static int getCodeByName(String name) {
            CustomGradeType[] timeZoneTypes = CustomGradeType.values();
            for (CustomGradeType timeZoneType : timeZoneTypes) {
                if (timeZoneType.getName() == name) {
                    return timeZoneType.getCode();
                }
            }
            return -1;
        }

    }

    public enum CustomOtherType {
        ////支付方式   1支付宝  3 微信  4百付宝 5 京东
        CustomType_1(1, "最后消费时间"),
        CustomType_2(2, "消费次数"),

        ;
        private int code;
        private String name;

        CustomOtherType(int code, String name) {
            this.code = code;
            this.name = name;
        }

        public int getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

        public static CustomOtherType getByCode(int code) {
            CustomOtherType[] timeZoneTypes = CustomOtherType.values();
            for (CustomOtherType timeZoneType : timeZoneTypes) {
                if (timeZoneType.getCode() == code) {
                    return timeZoneType;
                }
            }
            return null;
        }

        public static int getCodeByName(String name) {
            CustomOtherType[] timeZoneTypes = CustomOtherType.values();
            for (CustomOtherType timeZoneType : timeZoneTypes) {
                if (timeZoneType.getName() == name) {
                    return timeZoneType.getCode();
                }
            }
            return -1;
        }

    }

    //1:交易成功 2:交易失败 3:有退款 4:已撤单
    public enum TradeState {
        SUCCESS(1, "交易成功", R.mipmap.ic_pay_status_success),
        FAIL(2, "交易失败", R.mipmap.ic_pay_status_unpay_close),
        REFUND(3, "有退款", R.mipmap.ic_pay_status_refund),
        CANCEL(4, "已撤单", R.mipmap.ic_pay_status_refund),
        WAITPAY(5, "待支付", R.mipmap.ic_pay_status_unpay_close),;
        private int state;
        private String name;
        private int img;

        TradeState(int state, String name, int img) {
            this.state = state;
            this.name = name;
            this.img = img;
        }

        public int getState() {
            return state;
        }

        public String getName() {
            return name;
        }

        public int getImg() {
            return img;
        }

        public static TradeState getByState(int state) {
            TradeState[] couponStates = TradeState.values();
            for (TradeState couponState : couponStates) {
                if (couponState.getState() == state) {
                    return couponState;
                }
            }
            return null;
        }
    }


    public enum BankUi {
        BANK_UNKNOW(0, "未知", R.drawable.ic_launcher),
        BANK_GS(1, "工商银行", R.drawable.icon_managecard_bank_gs),
        BANK_GD(2,"光大银行", R.drawable.icon_managecard_bank_gd),
        BANK_GF(3, "广发银行",R.drawable.icon_managecard_bank_gf),
        BANK_HX(4, "华夏银行",R.drawable.icon_managecard_bank_hx),
        BANK_JS(5, "建设银行",R.drawable.icon_managecard_bank_js),
        BANK_JT(6, "交通银行",R.drawable.icon_managecard_bank_jt),
        BANK_MS(7, "民生银行", R.drawable.icon_managecard_bank_ms),
        BANK_NY(8, "农业银行",R.drawable.icon_managecard_bank_ny),
        BANK_PA(9, "平安银行", R.drawable.icon_managecard_bank_pa),
        BANK_PF(10, "浦发银行", R.drawable.icon_managecard_bank_pf),
        BANK_XY(11, "兴业银行", R.drawable.icon_managecard_bank_xy),
        BANK_ZS(12, "招商银行", R.drawable.icon_managecard_bank_zs),
        BANK_ZG(13, "中国银行", R.drawable.icon_managecard_bank_zg),
        BANK_ZX(14, "中信银行", R.drawable.icon_managecard_bank_zx),
        BANK_PDFZ(15, "浦东发展银行", R.drawable.icon_managecard_bank_pf),
        ;

        private int type;
        private String showName;
        private int icon_id;

        BankUi(int type, String showName, int icon_id) {
            this.type = type;
            this.showName = showName;
            this.icon_id = icon_id;
        }

        public int getType() {
            return type;
        }

        public int getIcon_id() {
            return icon_id;
        }

        public String getShowName() {
            return showName;
        }


        public static BankUi getByType(int type) {
            BankUi[] bankUis = BankUi.values();
            for (BankUi bankUi : bankUis) {
                if (bankUi.getType() == type) {
                    return bankUi;
                }
            }
            return null;
        }

        public static BankUi getTypeByName(String name) {
            if (StringUtils.isBlank(name)){
                return null;
            }
            BankUi[] bankUis = BankUi.values();
            for (BankUi bankUi : bankUis) {
                // if (bankUi.getShowName().equals(name)) {
                // return bankUi;
                // }
                if (name.contains(bankUi.getShowName())) {
                    return bankUi;
                }
            }
            return null;
        }

    }


}
